# 编译配置
BIN_NAME := genv
GO_CMD := go
BUILD_DIR := build
VERSION := 1.0.0

.PHONY: all build install clean test

all: build

build:
	@echo "Begin build..."
	@mkdir -p $(BUILD_DIR)
	@$(GO_CMD) build -o $(BUILD_DIR)/$(BIN_NAME) ./cmd

clean:
	@echo "Begin clean..."
	@rm -rf $(BUILD_DIR)

release:
	@echo "Begin release..."
	@GOOS=linux GOARCH=amd64 $(GO_CMD) build -o $(BUILD_DIR)/$(BIN_NAME)-linux-$(VERSION) ./cmd
	@GOOS=darwin GOARCH=arm64 $(GO_CMD) build -o $(BUILD_DIR)/$(BIN_NAME)-macos-$(VERSION) ./cmd

test:
	@echo "Begin test..."
	@$(GO_CMD) test -v ./...